#include <stdlib.h>
#include <math.h>

// X is the array
// numElement is the number of elements to be scanned
// offset is the starting index of the first elemetn in the sequence
// stride is the distance between the elements.
void seqScan(double *X, unsigned int numEl, unsigned int offset, unsigned int stride)
{
	unsigned int i;
	unsigned int end = offset + numEl * stride;
	for (i = offset + stride; i < end; i += stride)	
		X[i] += X[i-stride]; 
}

void seqAdd(double *X, double val, unsigned int numEl, unsigned int offset, unsigned int stride) {
	unsigned int i;
	unsigned int end = offset - 1 + numEl * stride;
	for (i = offset - 1 + stride; i <= end; i += stride)	
		X[i] += val; 
}
